package com.example.healthcondition.entity;

import java.math.BigDecimal;
import java.time.LocalDateTime;

public class HealthData {
    private Integer date_id;
    private Integer user_id;
    private BigDecimal weight; // 用于表示小数的字段
    private String blood_pressure;
    private Integer heart_rate;
    private String notes;
    private LocalDateTime recorded_at;
    private BigDecimal height; // 用户身高，单位为米
    private Integer age; // 用户年龄

    // 默认构造函数
    public HealthData() {
    }

    // 带所有属性的构造函数
    public HealthData(Integer date_id, Integer user_id, BigDecimal weight, String blood_pressure, Integer heart_rate, String notes, LocalDateTime recorded_at, BigDecimal height, Integer age) {
        this.date_id = date_id;
        this.user_id = user_id;
        this.weight = weight;
        this.blood_pressure = blood_pressure;
        this.heart_rate = heart_rate;
        this.notes = notes;
        this.recorded_at = recorded_at;
        this.height = height;
        this.age = age;
    }

    // Getter和Setter方法
    public Integer getDataId() {
        return date_id;
    }

    public void setDataId(Integer date_id) {
        this.date_id = date_id;
    }

    public Integer getUserId() {
        return user_id;
    }

    public void setUserId(Integer user_id) {
        this.user_id = user_id;
    }

    public BigDecimal getWeight() {
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    public String getBloodPressure() {
        return blood_pressure;
    }

    public void setBloodPressure(String blood_pressure) {
        this.blood_pressure = blood_pressure;
    }

    public Integer getHeartRate() {
        return heart_rate;
    }

    public void setHeartRate(Integer heart_rate) {
        this.heart_rate = heart_rate;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public LocalDateTime getRecordedAt() {
        return recorded_at;
    }

    public void setRecordedAt(LocalDateTime recorded_at) {
        this.recorded_at = recorded_at;
    }

    public BigDecimal getHeight() {
        return height;
    }

    public void setHeight(BigDecimal height) {
        this.height = height;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    // toString方法
    @Override
    public String toString() {
        return "HealthData{" +
                "date_id=" + date_id +
                ", user_id=" + user_id +
                ", weight=" + weight +
                ", blood_pressure='" + blood_pressure + '\'' +
                ", heart_rate=" + heart_rate +
                ", notes='" + notes + '\'' +
                ", recorded_at=" + recorded_at +
                ", height=" + height +
                ", age=" + age +
                '}';
    }

    // hashCode和equals方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        HealthData that = (HealthData) o;
        return date_id != null && date_id.equals(that.date_id);
    }

    @Override
    public int hashCode() {
        return date_id != null ? date_id.hashCode() : 0;
    }
}